﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplicationExperimental.DetailedControls
{
    /// <summary>
    /// Interaction logic for DocumentDetailedControl.xaml
    /// </summary>
    public partial class DocumentDetailedControl : UserControl
    {
        private DataAccesLayer.Document ReturnValue;

        public object  SourceDocument
        {
            get { return ReturnValue; }
            set {
                if (value is DataAccesLayer.Document)
                {
                    ReturnValue = value as DataAccesLayer.Document;
                    DispalyDocumentDetails(value as DataAccesLayer .Document );
                }
            }
        }

        public event Action OnCreated;

        public DocumentDetailedControl()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (OnCreated != null)
                OnCreated();
        }


        public void DispalyDocumentDetails(DataAccesLayer.Document document)
        {
            this.grid1.DataContext = document;
     //       this.SourceDocument = document;
        }

        private void txtEmployeeNumber_TextChanged(object sender, TextChangedEventArgs e)
        {

        }
    }
}
